﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Data;
using System.Data.SqlClient;

/// <summary>
/// Summary description for CategoryDAL
/// </summary>
public class CategoryDAL
{
    DataAccess db = new DataAccess();
	public CategoryDAL()
	{
		//
		// TODO: Add constructor logic here
		//
	}
    //display all category 
    public DataTable getAllCategory()
    {
        return db.executeSelect("GetAllCategory");
    }
    //display category by id
    public DataTable GetCategoryById(string _categoryid)
    {
        SqlParameter[] paramList = new SqlParameter[1];
        paramList[0] = new SqlParameter("@CategoryId", SqlDbType.VarChar, 50);
        paramList[0].Value = _categoryid;
        return db.executeSelect("GetCategoryById", paramList);
    }

    //display category by category
    public DataTable GetCategoryByName(string namecategory)
    {
        SqlParameter[] paramList = new SqlParameter[1];
        paramList[0] = new SqlParameter("@CategoryName", SqlDbType.VarChar, 50);
        paramList[0].Value = namecategory;
       
        return db.executeSelect("GetCategoryByName", paramList);
    }

  


}